package com.heima.tess4j;

import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import sun.net.www.content.image.png;

import java.io.File;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args ) throws Exception
    {
        //创键实例
        ITesseract tesseract = new Tesseract();
        //设置字体库路径
        tesseract.setDatapath("E:\\HMTT\\tessdata");
        //设置语言-->简体中文
        tesseract.setLanguage("chi_sim");
        //识别图片
        File file = new File("E:\\2.png");
        String s = tesseract.doOCR(file);
        System.out.println("结果"+s);
    }
}
